const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentItemId: 0,        // 当前第几棵树
    groupTreeType: [ {
      "id": "106",
      "productType": 35,
      "imageUrl": "https://static.isl.ren/isl_img/hezhongshop/shop_huyangnew.png",
      "img_bg":"",
      "img_bg-tree":"",
      "description": "沙漠植物11",
      "imageText": null,
      "idCode": "tree-huyang-hezhong",
      "goodsName": "胡杨",
      "currencyType": 10,
      "productPriceId": null,
      "price": 0.00,
      "openLevel": 0,
      "objectItemId": "2005",
      "oldPrice": 0.00,
      "itemObject": null,
      "index": 0
    },
    {
      "id": "101",
      "productType": 35,
      "imageUrl": "https://static.isl.ren/isl_img/hezhongshop/shop_ningtiaonew.png",
      "description": "沙漠植物1",
      "imageText": null,
      "idCode": "tree-ningtiao-hezhong",
      "goodsName": "柠条",
      "currencyType": 10,
      "productPriceId": null,
      "price": 0.00,
      "openLevel": 0,
      "objectItemId": "2000",
      "oldPrice": 0.00,
      "itemObject": null,
      "index": 0
    },
    {
      "id": "102",
      "productType": 35,
      "imageUrl": "https://static.isl.ren/isl_img/hezhongshop/shop_shaliunew.png",
      "description": "沙漠植物2",
      "imageText": null,
      "idCode": "tree-shaliu-hezhong",
      "goodsName": "沙柳",
      "currencyType": 10,
      "productPriceId": null,
      "price": 0.00,
      "openLevel": 0,
      "objectItemId": "2001",
      "oldPrice": 0.00,
      "itemObject": null,
      "index": 0
    }],        // 合种树木类型



  },

  // Swiper切换
  swiperChange: function (e) {
    let currentItemId = e.detail.currentItemId                 // 切换到第几帧Swiper
    let idCode = this.data.groupTreeType[currentItemId].idCode // 选择哪棵树木的idCode
    let selectTreePicture = this.data.groupTreeType[currentItemId].imageUrl//选择的树木图片

    // console.log("Swiper当前第几帧：", currentItemId)
    // console.log('树木类型idCode:', idCode)

    // 设置Data数据
    this.setData({
      currentItemId: currentItemId,
      idCode: idCode,
      selectTreePicture: selectTreePicture
    })
  },
})
